<?php

namespace App\Http\Controllers\Api\SmallApp\Advert;

use App\Http\Controllers\Common\ApiController;
use App\Models\Advert\Advert;
use Illuminate\Http\Request;

class AdvertController extends ApiController {

    public function lst(Request $request) {
        $limit = $request->input('limit',3);
        $records = (new Advert())->getLst(['type'=>1,'status'=>1])->limit($limit)->get();

        foreach ($records as $record) {
            $record->pic_url = asset($record->pic_url);
        }
        return responseSuccess($records->toArray());
    }
}
